@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal" id="salesDivisionForm">
            <input type="hidden" id="id" value="">
            <div class="row">
                <div class="col-sm-6 b-r">
                    <#select id="goodsCode" name="产品类型" underline = "true">
                        @for(good in goods){
                            <option value="${good.goodsCode}">${good.goodsName}(${good.goodsCode})</option>
                        @}
                    </#select>
                    <#select id="calculationType" name="计算方式" underline = "true">
                        <option value="0">按交易额计算</option>
                        <option value="1">按类型定拨</option>

                    </#select>
                    <#input id="remarks" name="备注" underline="false" />
                </div>
                <div class="col-sm-6">
                    <#input id="profitRatio" name="利润比例（%）" underline="true" />
                    <#input id="fixedAmount" name="定拨金额（每单）" underline="true"/>
                </div>
            </div>

            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="SalesDivisionInfoDlg.addSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="SalesDivisionInfoDlg.close()"/>
                </div>
            </div>
        </div>

    </div>
</div>
<script>
    console.log($('#calculationType option:selected') .val());
    if($('#calculationType option:selected') .val() == "0"){
        $('#fixedAmount').attr("disabled","disabled");
    }else if($('#calculationType option:selected') .val() == "1"){
        $('#profitRatio').attr("disabled","disabled");
    }
    $("#calculationType").change(function(){
        var opt=$("#calculationType").val();
        if(opt == 0 ){
            $('#fixedAmount').attr("disabled","disabled");
            $('#profitRatio').removeAttr("disabled");
        }else if(opt == 1){
            $('#profitRatio').attr("disabled","disabled");
            $('#fixedAmount').removeAttr("disabled");
        }
    });

</script>
<script src="${ctxPath}/static/modular/packback/salesDivision/salesDivision_info.js"></script>
@}
